home *** CD-ROM | disk | FTP | other *** search
- #include "crtlocal.h"
-
- /* modf() returns the fractional part of value and stores the
- integral part indirectly through iptr. Thus the argument
- value and the returned values modf() and *iptr satisfy
-
- (*iptr + modf) == value
-
- and both results have the same sign as value. The defini-
- tion of modf() varies among UNIX system implementations, so
- avoid modf() in portable code.
- */
-
- double modf(double value, double *iptr)
- {
- long x = (int) value;
- if (x >= 0)
- {
- if (value < (double)x) x--;
- }
- else
- {
- if (value > (double)x) x++;
- }
- *iptr = x;
- return value - *iptr;
- }
-
- int isinf(double x)
- {
- return 0;
- }
-
- int isnan(double x)
- {
- return 0;
- }
-
- double ldexp(double x, int n)
- {
- while (n-- > 0) x *= 2;
- while (++n < 0) x /= 2;
- return x;
- }
-